#include <iostream>
#include <memory>

#include "glm\glm.hpp"
#include "glm\gtx\quaternion.hpp"

#include "GL\glew.h"

#include <SFML\Window.hpp>
#include <SFML\System.hpp>



bool running = false;
bool initiated = false;

//std::shared_ptr<WRenderer> wRenderer = nullptr;
//std::shared_ptr<WLoader> wLoader = nullptr;

#define PI 3.1415926

void InitRenderThread() 
{
	//wRenderer = std::make_shared<WRenderer>(running);
	//wRenderer->Run();
}

void MainLoop()
{
	while(true)
	{
		if(running)
		{
			/*if(!initiated)
			{
				if(wRenderer != nullptr && wRenderer->ContextCreated())
				{
					std::shared_ptr<WLoadItem> item = std::shared_ptr<WLoadItem>(new WLoadItem(std::string(".\\Data\\Cube\\Cube.dae")));
					wRenderer->AddWLoadItem(item);

					std::cout<<"Finished Loading"<<std::endl;
					initiated = true;
				}
			}*/
		}
		else 
		{
			break;
		}
	}
}

void Cleanup(sf::Thread& renderThread)
{
	renderThread.terminate();
	//wRenderer = nullptr;
	//wLoader = nullptr;
}


void main()
{
	running = true;
	
	glEnable(GL_CULL_FACE);
	glCullFace(GL_BACK);

	sf::Thread thread(&InitRenderThread);
	thread.launch();

	/*
	sf::Thread thread2(&InitLoaderThread);
	thread2.launch();*/

	MainLoop();

	Cleanup(thread);
}